<template>
  <div @mouseenter="mouseover" @mouseleave="mouseover">
    <template v-for="subItem in item" >
      <el-submenu v-if="subItem.subs" :index="subItem.to" :key="subItem.to" class="g-submenu">
        <template slot="title"><span><i :class="subItem.icon"></i><span class="name">{{ subItem.title }}</span></span></template>
        <sidebarItem :item="subItem.subs" :key="subItem.to"></sidebarItem>
      </el-submenu>
      <el-menu-item v-else :index="subItem.to" :key="subItem.to" class="g-submenu">
        <i :class="subItem.icon"></i><span>{{ subItem.title }}</span>
      </el-menu-item>
    </template>
  </div>
</template>

<script>
export default {
  props:['item'],
  name: "sidebarItem",
  data() {return{}},
    methods: {
        mouseover(){
            this.$emit('change')
        }
    }
};
</script>

<style lang="css" scoped>

</style>